package org.jeecg.modules.paycenter.controller;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.paycenter.service.IMemberChannelService;
import org.jeecg.modules.paycenter.service.MemberChannelFactory;
import org.jeecg.modules.wlhy.utils.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 支付服务
 */
@RestController
@Slf4j
@RequestMapping("/paycenter/")
public class HyMemberController {

    @Autowired
    private UserUtil userUtil;

    //region 平台账户
    @GetMapping(value = "/pt/getAccountInfo")
    public Result<?> getPtAccountInfo(String channel) {
        if (!userUtil.isSys()) {
            return Result.error("无权限查看");
        }
        IMemberChannelService memberChannel = MemberChannelFactory.getMemberChannel(channel);
        if (!memberChannel.checkChannel()) {
            return Result.error("未开通支付服务");
        }
        return memberChannel.getPtAccountInfo();
    }
    //endregion


}
